package com.lanccj.aep.nbiot.configration;

import com.lanccj.aep.nbiot.propertie.AepIotProperties;
import com.lanccj.aep.nbiot.service.AepApiService;
import com.lanccj.aep.nbiot.service.AepMqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenjian_yq(lanccj)
 * @version 1.0
 * @description: 自动配置类
 * @date 2021/11/17 8:51
 */
@Configuration
@EnableConfigurationProperties(AepIotProperties.class)
@ConditionalOnClass(AepApiService.class)
public class AepIotConfigration {

    /**
     * Aep插件配置对象
     */
    @Autowired
    AepIotProperties aepIotProperties;

    /**
     * Aep API调用服务
     */
    @Bean
    public AepApiService aepIotService(){
        return new AepApiService(aepIotProperties);
    }

    /**
     * Aep MQ监听服务
     */
    @Bean
    public AepMqService aepMqService(){
        return new AepMqService(aepIotProperties);
    }
}
